@use 'sass:map';

@use './shared' as *;
@use './design' as *;

$spin: () !default;
$spin: map.merge(
  (
    z-index: get-css-var('z-index-masker'),
    mask-bg-color: get-css-var('bg-color-base'),
    mask-opacity: 40%,
    icon-color: get-css-var('color-primary-base'),
    tip-color: get-css-var('color-primary-base'),
    tip-font-size: get-css-var('font-size-secondary')
  ),
  $spin
);

.#{$namespace}-spin {
  &-vars {
    @include define-preset-values('spin', $spin);
  }

  @include basis;

  position: relative;

  &--inner,
  &__loading {
    position: absolute;
    inset: 0;
    z-index: get-css-var('spin-z-index');
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;

    & > * {
      pointer-events: auto;
    }
  }

  &__mask {
    position: absolute;
    inset: 0;
    background-color: get-css-var('spin-mask-bg-color');
    opacity: get-css-var('spin-mask-opacity');
  }

  &__icon {
    position: relative;
    color: get-css-var('spin-icon-color');
  }

  &__tip {
    position: relative;
    padding-top: 3px;
    font-size: get-css-var('spin-tip-font-size');
    color: get-css-var('spin-tip-color');
    user-select: none;
  }
}
